package com.example.mytayunapi.Service;

import com.example.mytayunapi.Entity.productsInfo;
import com.example.mytayunapi.Entity.publicInfo;
import com.example.mytayunapi.Entity.userInfo;
import com.example.mytayunapi.Mapper.publicInfoMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@Service
public class publicInfoServiceImpl implements publicInfoService {
    @Autowired
    private publicInfoMapper publicinfoMapper;

    @Override
    public Integer InsertPublicInfo(publicInfo publicinfo) {
        return  publicinfoMapper.InsertPublicInfo(publicinfo);
    }

    @Override
    public List<publicInfo> GetPublicInfo(String Public_title) {
        return publicinfoMapper.GetPublicInfo(Public_title);
    }

    @Override
    public List<publicInfo> getPublicInfo() {
        return publicinfoMapper.getPublicInfo();
    }

    @Override
    public Integer DeletePublicInfo(String Public_title) {
        return publicinfoMapper.DeletePublicInfo(Public_title);
    }

    @Override
    public Integer UpdatePublicInfo(@RequestBody publicInfo publicinfo) {
        return publicinfoMapper.UpdatePublicInfo(publicinfo);
    }

    //分页
    @Override
    public PageInfo<publicInfo> getPageInfo(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<publicInfo> publicInfo = publicinfoMapper.getPublicInfo();
        PageInfo<publicInfo> pageInfo = new PageInfo<>();
        return pageInfo;
    }


}
